package aspirecn.project3.exception;

import lombok.Data;
import aspirecn.project3.enums.BizCodeEnum;
/**
 * packageName aspirecn.project3.exception
 *
 * @author 邵一宸
 * @version JDK 17
 * @className BizException
 * @date 2024/7/19
 * @description TODO
 */

@Data
public class BizException extends RuntimeException {

    private int code;

    private String msg;

    public BizException(Integer code, String message) {
        super(message);
        this.code = code;
        this.msg = message;
    }



    public BizException(BizCodeEnum bizCodeEnum){
        super(bizCodeEnum.getMessage());
        this.code = bizCodeEnum.getCode();
        this.msg = bizCodeEnum.getMessage();
    }


}
